package test.orwapkg;

public class SampleClass {
	public static void main(String[] args) {
		AnotherSampleClass asc = new AnotherSampleClass();
		SampleClass sc = new SampleClass();
		// TODO code application logic here
		//asc = sc;  //wrong type cannot save object parent class in in its subclass 
		sc = asc;
		//asc = (Object) sc; //wrong cast cannot 
		//asc = sc.clone();
		enclosingClass encloseInst = sc.new enclosingClass();
		encloseInst.somefunction();
		
		SampleClass sc1 = new AnotherSampleClass();
		AnotherSampleClass asc1 = new AnotherSampleClass();
		
		((AnotherSampleClass)sc1).doSomething();
		
	}
	
	class enclosingClass{
		private void somefunction(){			
			System.out.println("inside some function in inner class");
			try {
				throw new RuntimeException("Exception throwed");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			}
	}
	
	public void doSomething(){System.out.println("Do something");}
}